<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>NewList</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="5">NewList</font></b></p>

<br><b>语法</b><blockquote><pre><font face="Courier New, Courier, mono"size="2"><b><font color="#3A3966">NewList</font></b> name.&lt;type&gt;()      
</font></pre></blockquote>
<b>概要</b><br><blockquote>


<b><font color="#3A3966">NewList</font></b> allows to declare a new dynamic list. Each element of the list is allocated dynamically. 
There are no element limits, so there can be as many as needed. A list can have any <a href="variables.html">Variables</a> standard or <a href="structures.html">structured</a> type. 
To view all commands used to manage lists, see the <a href="../list/index.html">List</a> library. <br>
<br>
The new list are always locals, which means <a href="global.html">Global</a> or <a href="shared.html">Shared</a> commands 
have to be used if a list declared in the main source need to be used in procedures. 
It is also possible to pass a list as parameter to a <a href="procedures.html">procedure</a> by using the 
keyword <b><font color="#3A3966">List</font></b>. 
<br>
<br>
For fast swapping of list contents the <a href="others.html">Swap</a> keyword is available. 

 

</blockquote><p><b>Example:</b> Simple list</p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">NewList</font></b> <font color="#3A3966">MyList</font>()
  
<font color="#3A3966">  AddElement</font>(<font color="#3A3966">MyList</font>())
<font color="#3A3966">  MyList</font>() = 10
  
<font color="#3A3966">  AddElement</font>(<font color="#3A3966">MyList</font>())
<font color="#3A3966">  MyList</font>() = 20
  
<font color="#3A3966">  AddElement</font>(<font color="#3A3966">MyList</font>())
<font color="#3A3966">  MyList</font>() = 30
  
  <b><font color="#3A3966">ForEach</font></b> <font color="#3A3966">MyList</font>()
    <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">MyList</font>()
  <b><font color="#3A3966">Next</font></b>
</font></pre>

</blockquote><p><b>Example:</b> List as procedure parameter</p><blockquote>


<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#3A3966">NewList</font></b> <font color="#3A3966">Test</font>()

<font color="#3A3966">  AddElement</font>(<font color="#3A3966">Test</font>())
<font color="#3A3966">  Test</font>() = 1
<font color="#3A3966">  AddElement</font>(<font color="#3A3966">Test</font>())
<font color="#3A3966">  Test</font>() = 2

  <b><font color="#3A3966">Procedure</font></b> <font color="#3A3966">DebugList</font>(c, <b><font color="#3A3966">List</font></b> <font color="#3A3966">ParameterList</font>())

<font color="#3A3966">    AddElement</font>(<font color="#3A3966">ParameterList</font>())
<font color="#3A3966">    ParameterList</font>() = 3

    <b><font color="#3A3966">ForEach</font></b> <font color="#3A3966">ParameterList</font>()
<font color="#3A3966">      MessageRequester</font>("List",<font color="#3A3966"> Str</font>(<font color="#3A3966">ParameterList</font>()))
    <b><font color="#3A3966">Next</font></b>
 
  <b><font color="#3A3966">EndProcedure</font></b>

<font color="#3A3966">  DebugList</font>(10,<font color="#3A3966"> Test</font>())
</font></pre>
</body></html>